﻿using ExpenseSystem.Core.DataAddOn;
using ExpenseSystem.Fether;
using ExpenseSystem.Model;

namespace ExpenseSystem.Core.BankModules
{
    public class BankBaseManager:BankManager
    {
        BankFetcher fetcher = new BankFetcher();
        public override bool Delete(BankModel bank, out string message)
        {
            if (bank.Site != profile.SiteId)
            {
                message = "当前登录的组织与档案所在组织不一致";
                return false;
            }

            bool result = bankUpdater.Remove(bank, tran, fetcher, out message);
            return result;
        }

        public override bool DeleteById(long[] CustomerIds, out string message)
        {
            bool result = true;
            result = bankUpdater.RemoveById(profile.SiteId, CustomerIds, tran, fetcher, out message);
            return result;
        }

        public override bool Save(BankModel Customer, out string message, params IAddable<BankModel>[] addables)
        {

            if (Customer.Site != profile.SiteId)
            {
                message = "当前登录的组织与档案所在组织不一致";
                return false;
            }
            bool result = true;
            result = bankUpdater.Save(Customer, tran, fetcher, out message);
            return result;
        }
    }
}
